<template>
	<view class="wrap">
		<home-title title="组队成员" type="2"></home-title>
		<view class="group">
			<view class="group_title" v-if="numberClusters">
				<text class="group_title_total">{{filterNull(numberClusters)}}</text>
				<text class="group_title_info"> · {{noNumberClusters}}</text>
			</view>

			<view v-if="customerVoList.length<6" class="group_team">
				
				<view v-for="(item, index) in customerVoList" :key="item.customerNo">
					
					<image :src="isEmptyImg(item.vxUrl)" style="width: 100rpx;height: 100rpx;margin: 0 10rpx;border-radius: 50rpx;" mode="scaleToFill"></image>
					
					<!-- <u-avatar size="50" class="group_team_avator" :src="item.vxUrl"></u-avatar> -->
				</view>
			</view>
			
			<view v-else class="group_team2">
				<view v-for="(item, index) in customerVoList" :key="item.customerNo">
					
					<image :src="isEmptyImg(item.vxUrl)" style="width: 100rpx;height: 100rpx;position: relative;border-radius: 50rpx;" :style="{'left':'-'+index*50+'rpx','z-index': 99-index}" mode="scaleToFill"></image>
					
					
					<!-- <u-avatar size="50" class="group_team_avator" :src="item.vxUrl"></u-avatar> -->
				</view>
			</view>

			<view v-if="!status">
				<button class="group_invite" @click="agreenTeam"> 同意组队 </button>
			</view>
			
			<view v-else>
				<view v-show="status == 1">
					<button class="group_invite" open-type="share" @click="clickShare" v-show="!isAgree"> 邀请好友 </button>
					<button class="group_invite" @click="agreenTeam" v-show="isAgree"> 同意组队 </button>
				</view>
			</view>

			


		</view>
	</view>
</template>

<script>
	import homeTitle from '../layout/mmv-home-title.vue'
	export default {
		name: 'detail-groupTeam',
		components: {
			homeTitle,
		},
		props: {
			activityId: {
				type: String,
				default: ''
			},
			status: {
				type: Number,
				default: 1
			},
			//成团数
			numberClusters: {
				type: String,
				default: ''
			},
			//相差人数
			noNumberClusters: {
				type: String,
				default: ''
			},
			//组队头像
			customerVoList: {
				type: Array,
				default () {
					return []
				}
			},
			isAgree: {
				type: Boolean,
				default: false
			},
			activityName: {
				type: String,
				default: ''
			},
			fsUrl: {
				type: String,
				default: ''
			},
			toCustomerNo: {
				type: String,
				default: ''
			}

		},

		methods: {
			clickShare() {
				this.$emit('share')
			},


			agreenTeam() {
				this.$emit('agreenTeam')
			},
			
			isEmptyImg(str){
				if(uni.$u.test.isEmpty(str)){
					return this.baseImageUrl+'uni_rental/用户默认头像.png'
				}else{
					return str
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	// .wrap {
	// 		position: relative;
	// }
	.group {
		background-color: #fff;
		border-radius: 20upx;
		padding: 0 0 40rpx;
		margin-top: 20upx;

		&_title {

			&_total {
				border-radius: 20upx 0 0 0;
				padding: 10upx 0 10upx 10upx;
				background-color: #FF5069;
				font-size: 22upx;
				font-weight: bold;
				color: #FFDD83;
			}

			&_info {
				border-radius: 0 0 20upx 0;
				padding: 10upx 20upx 10upx 10upx;
				background-color: #FF5069;
				font-size: 22upx;
				font-weight: bold;
				color: #ffffff;
			}
		}

		&_team {
			margin-top: 30upx;
			display: flex;
			align-items: center;
			justify-content: center;

			&_avator {
				width: 100upx;
				height: 100upx;
			}
		}

		&_invite {
			margin: 30rpx 43rpx 20rpx;
			height: 80upx;
			color: #fff;
			font-size: 32upx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: bold;
			text-align: center;
			background-color: #FF5069;
			border-radius: 40upx;
			line-height: 80upx;
		}
	}
	
	.group_team2{
		display: flex;
		margin-top: 30rpx;
		justify-content: center;
		transform: translateX(25%);
	}
</style>
